package cn.edu.scau.cmi.youbaiquan.simpleFactoryMethod;

import cn.edu.scau.cmi.youbaiquan.domain.AccidentsInsurance;
import cn.edu.scau.cmi.youbaiquan.domain.BodyInjuryInsurance;
import cn.edu.scau.cmi.youbaiquan.domain.CarDamageInsurance;
import cn.edu.scau.cmi.youbaiquan.domain.CasualtiesInsurance;
import cn.edu.scau.cmi.youbaiquan.domain.Insurance;

public class InsuranceFactory {
	public static Insurance getInstance(String insuranceTypeString) {
		Insurance insurance = null;
		switch (insuranceTypeString) {
		case "身体受伤":
			insurance = new BodyInjuryInsurance();
			break;
		case "汽车损坏":
			insurance = new CarDamageInsurance();
			break;
		case "人员伤亡":
			insurance = new CasualtiesInsurance();
			break;	
		case "多种事故":
			insurance = new AccidentsInsurance();
			break;
		}
		return insurance;
	}
}
